package day230319;

import java.util.Arrays;
import java.util.Scanner;

/**
 * @author 兴趣使然黄小黄
 * @version 1.0
 * @date 2023/3/19 20:35
 */
@SuppressWarnings({"all"})
public class Main1 {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt(); // 表示小组总数
        int[] level = new int[3*n]; // 存储队员的水平值
        for (int i = 0; i < level.length; i++) {
            level[i] = in.nextInt();
        }
        // 每三个一组进行排序
        for (int i = 0; i < level.length; i += 3) {
            Arrays.sort(level, i, i+3);
        }
        // 记录结果
        int retSum = 0;
        for (int i = 1; i < level.length; i += 3) {
            if (level[i] == level[i-1]){
                retSum += level[i+1];
            }else {
                retSum += level[i];
            }
        }
        System.out.println(retSum);
        in.close();
    }
}
